import {Injectable} from '@angular/core';
import {HttpUtils} from "../utils/http.utils";
import {USER} from "./user.service";
import {ParamsModel} from "../model/params.model";

@Injectable()
export class PAYMENT {


  constructor(private api:HttpUtils,
              private USER: USER) {
  }

  getAlipayPayment(params:any,success:any){
    let pm = new ParamsModel(this.USER);
    pm.url = '/payment/alipay/prepay/page/'+params.billNo;
    pm.reqestData = params;
    pm.succCallback = success;
    this.api.get(pm);
  }

  getWeChatPayment(params:any,success:any){
    let pm = new ParamsModel(this.USER);
    pm.url='/payment/wechat/prepay/wap/'+params.billNo;
    pm.succCallback = success;
    this.api.get(pm);
  }
  getBalancePayment(params:any,success:any){
    let pm = new ParamsModel(this.USER);
    pm.url = '/balance/pay';
    pm.reqestData = params;
    pm.succCallback = success;
    this.api.post(pm);
  }
  queryStatus(orderNo:string,success:any){
    let pm = new ParamsModel(this.USER);
    pm.url = `/payment/status/${orderNo}`;
    pm.reqestData = orderNo;
    pm.succCallback = success;
    this.api.get(pm);
  }


}
